﻿using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Test;
using System;
using System.Collections.Generic;

namespace Infrastructure.Util
{
    public class Config
    {
        public static IEnumerable<ApiResource> GetApiResources()
        {
            return new List<ApiResource>()
            {
                new ApiResource("api","myApi")
            };
        }

        public static IEnumerable<Client> GetClients()
        {
            return new List<Client>()
            {
                new Client(){
                    ClientId ="mvc",
                    ClientName ="Advance.Mvc" ,
                    ClientUri="http://localhost:5001",
                    LogoUri="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1098275667,3334517635&fm=27&gp=0.jpg",
                    AllowRememberConsent=true,
                    AllowedScopes= {
                        IdentityServerConstants.StandardScopes.Profile,
                        IdentityServerConstants.StandardScopes.OpenId,
                        IdentityServerConstants.StandardScopes.Email,
                    },
                    ClientSecrets={ new Secret("p@ssword".Sha256())},
                    AllowedGrantTypes= GrantTypes.Implicit,
                    RequireConsent=true,
                   RedirectUris={ "http://localhost:5001/signin-oidc"},
                   PostLogoutRedirectUris={ "http://localhost:5001/signout-callback-oidc" }
                },
            };
        }

        public static IEnumerable<TestUser> GetUsers()
        {
            return new List<TestUser>()
            {
                new TestUser(){
                     Password="p@ssw0rd",
                     SubjectId=Guid.NewGuid().ToString("N"),
                     Username="admin",
                     ProviderName="admin"
                },
            };
        }

        public static IEnumerable<IdentityResource> GetIdentityResources()
        {
            return new List<IdentityResource>()
            {
                    new IdentityResources.Email(),
                    new IdentityResources.Profile(),
                    new IdentityResources.OpenId()
            };
        }
    }
}
